package com.jprocms.module.cms.convert.investigate;

import com.jpro.framework.common.pojo.PageResult;
import com.jprocms.module.cms.controller.admin.investigate.vo.InvestigateCreateReqVO;
import com.jprocms.module.cms.controller.admin.investigate.vo.InvestigateRespVO;
import com.jprocms.module.cms.controller.admin.investigate.vo.InvestigateUpdateReqVO;
import com.jprocms.module.cms.dal.dataobject.investigate.InvestigateDO;
import org.mapstruct.Mapper;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 问卷调查 Convert
 *
 * @author jprocms
 */
@Mapper
public interface InvestigateConvert {

    InvestigateConvert INSTANCE = Mappers.getMapper(InvestigateConvert.class);

    InvestigateDO convert(InvestigateCreateReqVO bean);

    @Named(value = "convertMore")
    default InvestigateDO convertMore(InvestigateCreateReqVO bean) {
        InvestigateDO investigateDO = convert(bean);
        investigateDO.getItems().clear();
        return investigateDO;
    }

    InvestigateDO convert(InvestigateUpdateReqVO bean);

    @Named(value = "convertMore")
    default InvestigateDO convertMore(InvestigateUpdateReqVO bean) {
        InvestigateDO investigateDO = convert(bean);
        investigateDO.getItems().clear();
        return investigateDO;
    }

    InvestigateRespVO convert(InvestigateDO bean);

    List<InvestigateRespVO> convertList(List<InvestigateDO> list);

    PageResult<InvestigateRespVO> convertPage(PageResult<InvestigateDO> page);


}
